﻿using KinonekoSoftware.CodariaDB.Documents.Shenanigans;

namespace KinonekoSoftware.Studio.Utils
{
    public static class TalkingFactory
    {
        public static TalkingMSG Get(TalkingObject talking, Func<string, Character> characterFactory)
        {
            if (talking is ImageTalking imgTalking)
            {
                return new ImageMSG
                {
                    TargetObject = imgTalking,
                    Character    = characterFactory(imgTalking.ActorID),
                };
            }
            
            if (talking is EmojiTalking emojiTalking)
            {
                return new EmojiMSG
                {
                    TargetObject = emojiTalking,
                    Character    = characterFactory(emojiTalking.ActorID),
                };
            }

            if (talking is PlainTextTalking ptTalking)
            {
                return new PlainTextMSG
                {
                    TargetObject = ptTalking,
                    Character    = characterFactory(ptTalking.ActorID),
                };
            }

            if (talking is TipTalking tTalking)
            {
                return new TipMSG
                {
                    TargetObject = tTalking,
                };
            }

            if (talking is UltraTipTalking utTalking)
            {
                return new UltraTipMSG
                {
                    TargetObject = utTalking,
                };
            }

            return null;
        }
    }
}